home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- // FILENAME: eTPointmark.m
- // SUMMARY: Implementation of single-point markers in eText
- // SUPERCLASS: eTBookmark
- // INTERFACE: None
- // PROTOCOLS: <Annotation,HTMDSupport,ASCIISupport,LaTeXSupport,Tool,
- // InspectableTarget>
- // AUTHOR: Rohit Khare
- // COPYRIGHT: (c) 1994 California Institure of Technology, eText Project
- ///////////////////////////////////////////////////////////////////////////////
- // IMPLEMENTATION COMMENTS
- // This is a tricky set of workarounds for eTBookmark.
- ///////////////////////////////////////////////////////////////////////////////
- // HISTORY
- // 10/31/94: Created. Kludged together as a subclass of Bookmarks.
- ///////////////////////////////////////////////////////////////////////////////
-
- #import "eTPointmark.h"
- #define _eTPointmarkVERSION 10
-
- @implementation eTPointmark
-
- + toolAwake:theApp
- {
- char buf[MAXPATHLEN];
- NXBundle *bundle;
-
- bundle = [NXBundle bundleForClass:[eTBookmark class]];
- if ([bundle getPath:buf forResource:".pm" ofType:"tiff"] ) {
- theIcon = [[NXImage alloc] initFromFile:buf];
- [theIcon setName:".pm"];
- } else {
- NXLogError("Image not found: .pm");
- }
- [theApp registerAnnotation: [eTPointmark class]
- name: "eTPointmark"
- RTFDirective: "eTPointmark"
- menuLabel: "Mark Point"
- menuKey: 0
- menuIcon: (NXImage *) theIcon];
- return self;
- }
-
- - init
- {
- [super init];
- theIcon = [NXImage findImageNamed:".pm"];
- if (theTextFieldCell) {
- theTextFieldCell=[theTextFieldCell free];
- }
- collapsed = NO;
- return self;
- }
-
- - initFromPboard:thePboard inDoc:theDoc linked:(BOOL) linked
- {
- // No registration calls!
-
- [self init];
- etDoc = theDoc;
- anchorID = [NXApp uniqueID];
- anchorTitle = NXUniqueString([[theDoc docInfo] docTitle]);
- [etDoc registerNotification:self];
- [self click:self];
- return self;
- }
-
- - setCondition:(const char *) newCondition {return self;}
- - collapse {return self;}
- - expand {return self;}
-
- - doubleClick:sender
- {
- return self;
- }
-
- - highlight:sender
- {
- int begin,end;
-
- begin = [theText positionForAnnotation:self];
- if (begin == -1) {NXBeep(); return self;}
-
- // find eoparagraph and insert an end there
- end =[theText positionFromLine:([theText lineFromPosition:begin]+1)]-1;
- if (end < begin) end = begin+1;
-
- [theText setSel:(begin) :(end+1)];
- [theText scrollSelToVisible];
- return self;
- }
-
- @end